package com.hzit.mmcb.core.service.impl;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hzit.mmcb.core.pojo.entity.UserLoginRecord;
import com.hzit.mmcb.core.mapper.UserLoginRecordMapper;
import com.hzit.mmcb.core.service.UserLoginRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 用户登录记录表 服务实现类
 * </p>
 *
 * @author ljh
 * @since 2024-08-27
 */
@Service
public class UserLoginRecordServiceImpl extends ServiceImpl<UserLoginRecordMapper, UserLoginRecord> implements UserLoginRecordService {

    @Override
    public List<UserLoginRecord> listById(Long id) {
        QueryWrapper<UserLoginRecord> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("user_id",id)
                .orderByDesc("update_time")
                .last("limit 50");
        List<UserLoginRecord> list = this.list(queryWrapper);

        return list;
    }
}
